package com.hongyue.xuesheng.YunSuanLei;

import com.hongyue.xuesheng.JiBenLei.XueYuan;
import com.hongyue.xuesheng.ShuJuLei.XueShengKu;

import java.util.ArrayList;

public class XueShengYunSuan {
    public boolean xsys(XueYuan xy) {
        XueShengKu xsk = new XueShengKu();
        return xsk.XueShengKu(xy);
    }
    private ArrayList<XueYuan> sj = new XueShengKu().XueHaoPD();

    public boolean XueHaoPD(String sid) {
        for (int i = 0; i < sj.size(); i++) {
            if (sj.get(i).getId().equals(sid)) {
                return false;
            }
        }
        return true;
    }

    public boolean ShanChu(String s) {
        for (int i = 0; i < sj.size(); i++) {
            if (sj.get(i).getId().equals(s)) {
                sj.remove(i);
                return true;
            }
        }
        return false;
    }

    public boolean XiuGai(XueYuan xy) {
        for (int i = 0; i < sj.size(); i++) {
            if (sj.get(i).getId().equals(xy.getId())) {
                sj.set(i,xy);
                return true;
            }
        }
        return false;
    }

    public ArrayList<XueYuan> ChaKan() {
        return sj;
    }
}
